TEAM MEMBERS
| Name | Email Id | Student Id |
|---|---|---|
| Karan Grag | @student.monash.edu | |
| Jiaying Zhang | @student.monash.edu | |
| Ziyao Wang | zwan0008@student.monash.edu | 27925315 |
The data used for the analysis records the criminal incidents in Victoria from 2010 December to 2020 December. It is collected from the Crime Statistics Agency of Victoria Government. The copyright is under the CC-BY 4.0 license, which allows the team to apply the data analysis with minimum restrictions on the use of the data.
The purpose of this analysis report is to assist the policy maker to adjust or re-assign the police resources, possibly providing some insights on the future development on the social security.
In the data analysis, it contains three main parts:
1 To obtain an overview of the criminal incidents among Victoria’s police regions. Also, observing the changes of incidents recorded over time to seek some trend or pattern in different local goverment areas.
2 To understand the criminal activity better, it will not only show the record changes over time but also the changes of offence sub-groups and sub-divisions. This will provide a precise landscape of criminal activities in Victoria.
3 Building on the previous analysis, this part will explore the dissect the criminal activities among different suburbs or towns in Victoria.
| Police.Region | Total_Incidents |
|---|---|
| 1 North West Metro | 1442412 |
| 3 Southern Metro | 856043 |
| 2 Eastern | 798741 |
| 4 Western | 584529 |
| Justice Institutions and Immigration Facilities | 10764 |
| Unincorporated Vic | 973 |
Total number of incidents recorded in each police region
Crimial activity trend in different suburbs from North West Metro
No .of incidents of top offennce in each LGA
Trend of each Offence_subdivision from year 2011-2020
Incidents of each offence_subgroup in most recorded offence_subdivision
Trend of incidents of each offence_subgroup
| Suburb | Total_Incidents |
|---|---|
| Melbourne | 153694 |
| Dandenong | 58610 |
| Frankston | 57645 |
| Preston | 40185 |
| Shepparton | 39651 |
| Mildura | 39120 |
| St Kilda | 34484 |
| Reservoir | 32532 |
| Werribee | 32009 |
| Richmond | 31638 |
Top 10 Suburb with most incidents recorded
Top 10 Offences recorded
Top 10 Offfences Suburrb wise
Conclusion
References [1]
Thank You!
---
title: "Analysis report for criminal incidents in Victoria"
output:
flexdashboard::flex_dashboard:
storyboard: true
vertical_layout: scroll
orientation: rows
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(readxl)
library(haven)
library(ggplot2)
library(kableExtra)
library(ggResidpanel)
library(bookdown)
library(plotly)
library(here)
library(dplyr)
library(naniar)
library(tidytext)
library(knitr)
```
Introduction {data-icon="fa-address-book"}
=====================================
```{r , fig.align ="center"}
include_graphics("police.jpeg")
```
Row
-----
***
**TEAM MEMBERS**
|Name |Email Id |Student Id|
|---------------|:-------------------------:|----------|
|Karan Grag |@student.monash.edu| |
|Jiaying Zhang |@student.monash.edu| |
|Ziyao Wang |zwan0008@student.monash.edu|27925315 |
***
Row
----
### Data Description
The [data](https://www.crimestatistics.vic.gov.au/crime-statistics/latest-victorian-crime-data/download-data-0) used for the analysis records the criminal incidents in Victoria from 2010 December to 2020 December. It is collected from the [Crime Statistics Agency](https://www.crimestatistics.vic.gov.au/about-us/contact-us) of Victoria Government. The copyright is under the [CC-BY 4.0 license](https://creativecommons.org/licenses/by/4.0/), which allows the team to apply the data analysis with minimum restrictions on the use of the data.
The **purpose of this analysis report** is to assist the policy maker to adjust or re-assign the police resources, possibly providing some insights on the future development on the social security.
In the data analysis, it contains three main parts:
- 1 To obtain an overview of the criminal incidents among Victoria's police regions. Also, observing the changes of incidents recorded over time to seek some trend or pattern in different local goverment areas.
- 2 To understand the criminal activity better, it will not only show the record changes over time but also the changes of offence sub-groups and sub-divisions. This will provide a precise landscape of criminal activities in Victoria.
- 3 Building on the previous analysis, this part will explore the dissect the criminal activities among different suburbs or towns in Victoria.
Section 1 {data-icon="fa-github"}
=====================================
```{r cleandata, include=FALSE}
dat <- read_excel("data/Data_Tables_LGA_Criminal_Incidents_Year_Ending_December_2020.xlsx", sheet=2)
dat <- dat %>%
select(c(Year, `Police Region`, `Local Government Area`, `Incidents Recorded`))
```
```{r readdata, include=FALSE}
dat1 <- read.csv("data/LGA_Criminal_data2020.csv")
```
Row {data-width=1000}
------
### Table 1 - To observe the total number of incidents recorded for each police region
```{r table1, message=FALSE}
dat_tot <- dat1 %>%
filter(`Local.Government.Area` == "Total") %>%
group_by(`Police.Region`) %>%
summarise(Total_Incidents = sum(`Incidents.Recorded`)) %>%
arrange(-Total_Incidents)
table1 <- dat_tot %>%
knitr::kable(caption = "Number of Incidents Recorded in different Police Region", align = 'c') %>%
kable_styling(bootstrap_options = c("striped", "hover","basic"))
table1
```
---
- **North West Metro** police region has recorded maximum incidents during the period.
Row {.tabset data-width=1000}
-------------------------------------
### Chart 2 - Incidents reocrded by different police region over time.
```{r total,fig.cap = "Total number of incidents recorded in each police region", fig.height=8, fig.align='center',fig.width=10}
dat_var <- dat1 %>%
filter(`Local.Government.Area` == "Total") %>%
group_by(Year, `Police.Region`) %>%
summarise(Total_Incidents = sum(`Incidents.Recorded`))
figure1 <- ggplot(dat_var, aes(x= Year,
y = Total_Incidents,
color = `Police.Region`))+
geom_line() +
geom_point() +
scale_x_continuous(breaks=seq(2011,2020,2)) +
theme_bw()+
facet_wrap(~ `Police.Region`, scales = "free",ncol=2)+
scale_fill_brewer(palette = "Dark2")
ggplotly(figure1)
```
---
- In the four main police regions of Victoria, it illustrates an evident fact that the number of incidents recorded has reached the *peak around early 2016*, then has a sudden pungle afterward.
### Chart 3 - Crimial activity in North West Metro area.
```{r north, fig.cap = "Crimial activity trend in different suburbs from North West Metro", fig.align='center', fig.height=11,fig.width=10}
dat_North <- dat1 %>%
filter(Police.Region == "1 North West Metro") %>%
select(-X)
trend <- dat_North %>%
group_by(Local.Government.Area, Year) %>%
summarise(Total_Incidents = sum(`Incidents.Recorded`)) %>%
arrange(-Total_Incidents) %>%
filter(Local.Government.Area %in% c("Melbourne",
"Hume",
"Brimbank",
"Wyndham",
"Whittlesea",
"Moreland",
"Banyule",
"Darebin",
"Hobsons Bay",
"Maribyrnong",
"Melton",
"Moonee Valley",
"Nillumbik",
"Yarra"))
figure2 <- ggplot(trend, aes(x= Year,
y = Total_Incidents,
color = Local.Government.Area))+
geom_line()+
geom_point() +
scale_x_continuous(breaks=seq(2011,2020,2)) +
facet_wrap(~ `Local.Government.Area`, scales = "free",ncol=2)+
scale_fill_brewer(palette = "Dark2")+
theme_bw()
ggplotly(figure2)
```
Section 2 {data-icon="fa-github-alt"}
=====================================
```{r read-data, include=FALSE}
criminaldata <- read_excel("data/Data_Tables_LGA_Criminal_Incidents_Year_Ending_December_2020.xlsx", sheet = 4)
```
```{r datacleaning, include=FALSE}
criminaluse <- criminaldata %>%
select(Year,
`Local Government Area`,
`Offence Subdivision`,
`Incidents Recorded`)
```
- 1
Row {data-width=500, data-height = 650}
---
### Chart 1
```{r vis1, fig.width=9,fig.height=12,fig.cap="No .of incidents of top offennce in each LGA"}
criminalfinal<- criminaluse %>%
mutate(lgth = str_length(`Offence Subdivision`)) %>%
mutate(`Offence Subdivision` = substr(`Offence Subdivision`,start = 5,stop = lgth)) %>%
mutate(`Offence Subdivision` = str_replace(`Offence Subdivision`,"r crimes against the person","Other crimes against the person")) %>%
group_by(`Local Government Area`, `Offence Subdivision` ) %>%
summarise(incidents = sum(`Incidents Recorded`))
data<- criminalfinal %>% arrange(desc(incidents)) %>%
slice(1) %>%
ggplot(aes(y=reorder(`Local Government Area`,incidents),
x=incidents,
fill = `Offence Subdivision`)) +
geom_col()+
geom_text(aes(label = incidents)) +
xlab("No. of Incidents") +
ylab("Local Government Area") +
theme(axis.text.x = element_blank())
ggplotly(data)
```
Row {data-width=500, data-height = 650}
---
### Chart 2
```{r vis2, fig.width=10, fig.cap="Trend of each Offence_subdivision from year 2011-2020"}
criminalfinal2<- criminaluse %>%
mutate(lgth = str_length(`Offence Subdivision`)) %>%
mutate(`Offence Subdivision` = substr(`Offence Subdivision`,start = 5,stop = lgth)) %>%
mutate(`Offence Subdivision` = str_replace(`Offence Subdivision`,"r crimes against the person","Other crimes against the person")) %>%
group_by(Year,
`Offence Subdivision` ) %>%
summarise(incidents = sum(`Incidents Recorded`)) %>%
ggplot(aes(x=as.numeric(Year),
y=incidents,
color = `Offence Subdivision` )) +
geom_line()+
geom_point() +
scale_x_continuous() +
ylab("No. of Incidents") +
scale_x_continuous(breaks=seq(2011,2020,2)) +
xlab("Year")
ggplotly(criminalfinal2) %>%
hide_legend()
```
Column {data-height=800, data-width = 1000}
--------------------------------
### Chart 3
```{r datacleaning2, include=FALSE}
criminaluse2 <- criminaldata %>%
select(Year,
`Offence Subgroup`,
`Offence Subdivision`,
`Incidents Recorded`) %>%
filter(`Offence Subdivision` == "B40 Theft")
```
```{r vis3, fig.width=10, fig.cap="Incidents of each offence_subgroup in most recorded offence_subdivision"}
criminalfinal3<- criminaluse2 %>%
group_by(Year, `Offence Subgroup`) %>%
summarise(incidents = sum(`Incidents Recorded`)) %>%
ggplot(aes(Year,
incidents,
fill = `Offence Subgroup` )) +
geom_col()+
ggtitle("Incidents of each offence_subgroup in most recorded offence_subdivision")
ggplotly(criminalfinal3)
```
Column {data-height=800, data-width = 1000}
--------------------------------
### Chart 4
```{r datacleaning3, include=FALSE}
criminaluse3 <- criminaldata %>%
select(Year,
`Offence Subgroup`,
`Incidents Recorded`)
```
```{r vis4, fig.width=10, fig.cap="Trend of incidents of each offence_subgroup"}
criminalfinal4<- criminaluse3 %>%
mutate(lgth = str_length(`Offence Subgroup`)) %>%
mutate(`Offence Subgroup` = substr(`Offence Subgroup`,start = 5,stop = lgth)) %>%
mutate(`Offence Subgroup` = str_replace(`Offence Subgroup`,"r crimes against the person","Other crimes against the person")) %>%
group_by(Year, `Offence Subgroup`) %>%
summarise(incidents = sum(`Incidents Recorded`)) %>%
arrange(`Offence Subgroup`,desc(incidents)) %>%
ggplot(aes(Year,
incidents,
color = `Offence Subgroup`)) +
geom_line()+
scale_x_continuous(breaks=seq(2011,2020,2))+
geom_point() +
ylab("No. of Imcidents")
ggplotly(criminalfinal4) %>%
hide_legend()
```
Section 3 {data-icon="fa-gitlab"}
=====================================
```{r read-file,include=FALSE}
data3 <- read_excel(here::here("data/Data_Tables_LGA_Criminal_Incidents_Year_Ending_December_2020.xlsx"),sheet = 4)
```
```{r clean,include=FALSE}
miss_var_summary(data3)
data3 <- data3 %>%
rename(Month = `Year ending`,
LGA = `Local Government Area`,
Suburb = `Suburb/Town Name`,
Offence_Division = `Offence Division`,
Offence_Subdivision = `Offence Subdivision`,
Offence_Subgroup = `Offence Subgroup`,
Incidents_Recorded = `Incidents Recorded`)
```
Row {data-width=650}
---
### Table
```{r Q1-table,echo=FALSE}
data3 %>%
group_by(Suburb) %>%
summarise(Total_Incidents = sum(Incidents_Recorded)) %>%
slice_max(Total_Incidents,n = 10) %>%
kable(caption = "Suburbs with maximum incidents over the years") %>%
kable_styling(bootstrap_options = c("striped","hover","basic"))
```
Row {data-width=1000}
--------------------------------
### Chart 1
```{r Q1,echo=FALSE,fig.width=8,fig.height=15,fig.cap="Top 10 Suburb with most incidents recorded"}
data3 %>%
group_by(Year,Suburb) %>%
summarise(Total_Incidents = sum(Incidents_Recorded)) %>%
arrange(Year,desc(Total_Incidents)) %>%
slice_max(Total_Incidents,n = 10) %>%
mutate(Suburb1 = reorder_within(Suburb,Total_Incidents,Year)) %>%
ggplot(aes(x=Total_Incidents ,
y=Suburb1,
fill = Suburb)) +
geom_col() +
geom_text(aes(label = Total_Incidents)) +
scale_y_reordered() +
ylab("Suburb") +
xlab("No. of Incidents") +
ggtitle("Top 10 Suburb with most incidents recorded in each Years") +
facet_wrap(~Year,ncol = 1, scales = "free")
```
### Chart 2
```{r Q2,echo=FALSE,fig.width=12,fig.height=15,fig.cap="Top 10 Offences recorded"}
data3 %>%
mutate(lgth = str_length(Offence_Subdivision)) %>%
mutate(Offence_Subdivision = substr(Offence_Subdivision,start = 5,stop = lgth)) %>%
mutate(Offence_Subdivision = str_replace(Offence_Subdivision,"r crimes against the person","Other crimes against the person")) %>%
group_by(Year,Offence_Subdivision) %>%
summarise(Tot_incidents = sum(Incidents_Recorded)) %>%
arrange(Year,desc(Tot_incidents)) %>%
slice_max(Tot_incidents,n = 10) %>%
mutate(Offence1 = reorder_within(Offence_Subdivision,Tot_incidents,Year)) %>%
ggplot(aes(y= Offence1,
x= Tot_incidents,
fill = Offence_Subdivision)) +
geom_col() +
geom_text(aes(label = Tot_incidents)) +
scale_y_reordered() +
ylab("Type of Offece") +
xlab("No of Incidents") +
facet_wrap(~Year,ncol = 1,scales = "free")
```
Column {data-height=800, data-width = 1000}
-------------------------------------
### Chart 4
```{r Q3,echo=FALSE,fig.width=10,fig.height=4,fig.cap="Top 10 Offfences Suburrb wise"}
Suburb_imp <- data3 %>%
group_by(Year,Suburb) %>%
summarise(Total_Incidents = sum(Incidents_Recorded)) %>%
arrange(Year,desc(Total_Incidents)) %>%
slice_max(Total_Incidents,n = 10)
Q3graph <- data3 %>%
mutate(lgth = str_length(Offence_Subdivision)) %>%
mutate(Offence_Subdivision = substr(Offence_Subdivision,start = 5,stop = lgth)) %>%
mutate(Offence_Subdivision = str_replace(Offence_Subdivision,"r crimes against the person","Other crimes against the person")) %>%
filter(Suburb %in% unique(Suburb_imp$Suburb)) %>%
group_by(Suburb,Offence_Subdivision) %>%
summarise(Tot_incidents = sum(Incidents_Recorded)) %>%
slice_max(Tot_incidents,n = 2) %>%
arrange(-Tot_incidents) %>%
#mutate(offence1 = reorder_within(Offence_Subdivision,Tot_incidents,Suburb)) %>%
ggplot(aes(y= Suburb,
x =Tot_incidents,
fill = Offence_Subdivision)) +
geom_col()
ggplotly(Q3graph)
```
Column {data-height=800, data-width = 1000}
-------------------------------------
### Chart 5
```{r Q4,echo=FALSE,fig.width=10,fig.height=10,Fg.cap="Trend of Top 2 Offences in each year w.r.t Suburb" }
Q4graoh <- data3 %>%
mutate(lgth = str_length(Offence_Subdivision)) %>%
mutate(Offence_Subdivision = substr(Offence_Subdivision,start = 5,stop = lgth)) %>%
mutate(Offence_Subdivision = str_replace(Offence_Subdivision,"r crimes against the person","Other crimes against the person")) %>%
filter(Suburb %in% unique(Suburb_imp$Suburb)) %>%
group_by(Year,Suburb,Offence_Subdivision) %>%
summarise(Tot_incidents = sum(Incidents_Recorded)) %>%
slice_max(Tot_incidents,n = 2) %>%
ggplot(aes(x= as.numeric(Year),
y =Tot_incidents,
color = Offence_Subdivision)) +
geom_line() +
geom_point() +
scale_x_continuous(breaks=seq(2011,2020,2)) +
xlab("Year") +
ylab("Total_incidents") +
facet_wrap(~Suburb)
ggplotly(Q4graoh)
```
Conclusion & References {data-icon="fa-table"}
=====================================
**Conclusion**
- bullet
***
**References**
[1]
***
Thank You!